import request from '@/utils/http'
import { BaseResponse } from '@/types/api'

// 推广员列表
export function promoterList(data: object) {
  return request.put<BaseResponse>({
    url: `brokerage/promoter/page`,
    params: data
  })
}
// 推广商品列表
export function promoteProducts(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/product/getProductPage`,
    params: data
  })
}
// 分销推广-统计数据获取
export function promoteStatc() {
  return request.get<BaseResponse>({
    url: `brokerage/promoter/statistics`
  })
}
// 分销推广-推广员信息修改
export function updatePromote(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/promoter/update`,
    data
  })
}

export function updatePromoteStatus(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/promoter/updateStatus`,
    data
  })
}

// 分销推广-推广员下拉列表
export function promoteSelect(data: object) {
  return request.get<BaseResponse>({
    url: `brokerage/promoter/options`,
    params: data
  })
}
// 分销推广-推广员新增
export function addPromote(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/promoter/add`,
    data
  })
}
// 分销推广-推广员等级下拉
export function levelList() {
  return request.get<BaseResponse>({
    url: `brokerage/level/options`
  })
}
// 分销推广-添加商品
export function addProduct(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/product/addProduct`,
    data
  })
}
// 分销推广-推广业绩
export function OrderPageList(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/order/getOrderPage`,
    data
  })
}
// 分销推广-默认基础配置查询
export function getDefault() {
  return request.get<BaseResponse>({
    url: `brokerage/tradeConfig/getDefault`
  })
}
// 分销推广-默认基础配置修改
export function settingUpdate(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/tradeConfig/update`,
    data
  })
}
// 分销推广-默认基础配置添加
export function settingAdd(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/tradeConfig/add `,
    data
  })
}
// 分销推广-推广等级
export function promotionLevel() {
  return request.put<BaseResponse>({
    url: `brokerage/level/getList`
  })
}
// 分销推广-新增推广等级
export function addPromotionLevel(data: object) {
  return request.put<BaseResponse>({
    url: `brokerage/level/add`,
    data
  })
}
// 分销推广-删除推广等级
export function delPromotionLevel(id: string) {
  return request.del<BaseResponse>({
    url: `brokerage/level/delete/${id}`
  })
}
// 分销推广-修改推广等级状态
export function editLevelState(id: string | number, state: number) {
  return request.get<BaseResponse>({
    url: `brokerage/level/${id}/onOff/${state}`
  })
}
// 分销推广-编辑推广等级
export function editLevelInfo(data: object) {
  return request.put<BaseResponse>({
    url: `brokerage/level/update`,
    data
  })
}
// 分销推广-移出推广商品
export function removeProducts(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/product/delete`,
    data
  })
}
// 分销推广-业绩排行
export function getPerformancePage(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/order/getPerformancePage`,
    data
  })
}
// 分销推广-修改商品分销比率
export function updateProduct(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/product/updateProduct`,
    data
  })
}
// 优惠券列表
export function couponsList(data: object) {
  return request.post<BaseResponse>({
    url: `coupons/page`,
    data
  })
}
// 优惠券新增
export function addCoupons(data: object) {
  return request.post<BaseResponse>({
    url: `coupons/add`,
    data
  })
}
// 模板下载
export function downloadTemplate() {
  return request.get<Promise<Blob>>({
    url: `brokerage/promoter/exportTemplate`,
    responseType: 'blob'
  })
}
// 优惠券删除
export function delCoupons(data: string[]) {
  return request.del<BaseResponse>({
    url: `coupons`,
    data
  })
}
// 优惠券编辑
export function editCoupons(data: object) {
  return request.post<BaseResponse>({
    url: `coupons/update`,
    data
  })
}
// 领劵记录分页列表
export function couponsGetRecord(data: object) {
  return request.put<BaseResponse>({
    url: `coupons/page/couponsGetRecord`,
    data
  })
}
// 营销活动新增
export function addActive(data: object) {
  return request.post<BaseResponse>({
    url: `marketingActivity/add`,
    data
  })
}
// 营销活动编辑
export function editActive(id: any, data: object) {
  return request.put<BaseResponse>({
    url: `marketingActivity/update/${id}`,
    data
  })
}
// 营销活动分页查询
export function activityGetPage(data: object) {
  return request.get<BaseResponse>({
    url: `marketingActivity/getPage`,
    params: data
  })
}
// 获取单个营销活动详情
export function getActivityInfo(id: string) {
  return request.get<BaseResponse>({
    url: `marketingActivity/${id}/form`
  })
}
// 删除活动
export function delActivity(ids: string) {
  return request.del<BaseResponse>({
    url: `marketingActivity/del/${ids}`
  })
}
// 参与记录
export function getActiveRecord(data: object) {
  return request.get<BaseResponse>({
    url: `marketingActivity/getUserActivityRecord`,
    params: data
  })
}
//回复列表
export function getAutoReplyPage(data: object) {
  return request.get<BaseResponse>({
    url: '/wp/getAutoReplyPage',
    params: data
  })
}
//新增回复
export function addAutoReply(data: object) {
  return request.post<BaseResponse>({
    url: '/wp/addAutoReply',
    data
  })
}

//编辑回复
export function editAutoReply(id: string, data: object) {
  return request.put<BaseResponse>({
    url: `/wp/updateAutoReply/${id}`,
    data
  })
}
//删除回复
export function delAutoReply(ids: number) {
  return request.del<BaseResponse>({
    url: `/wp/delAutoReply/${ids}`
  })
}
//获取自定义菜单配置
export function customizeMenuList() {
  return request.get<BaseResponse>({
    url: `wp/menuGet`
  })
}
//获取自定义菜单配置
export function customMenuCreate(data: object) {
  return request.post<BaseResponse>({
    url: `wp/menuCreate`,
    data
  })
}
//新增秒杀活动
export function addSaleActive(data: object) {
  return request.post<BaseResponse>({
    url: `marketingActivity/add`,
    data
  })
}
//编辑秒杀活动
export function editSaleActive(data: object, id: string) {
  return request.put<BaseResponse>({
    url: `marketingActivity/update/${id}`,
    data
  })
}
//删除秒杀活动
export function delSaleActive(ids: string) {
  return request.del<BaseResponse>({
    url: `marketingActivity/del/${ids}`
  })
}
//编辑秒杀活动状态
export function editSaleActiveState(id: string, data: object) {
  return request.put<BaseResponse>({
    url: `marketingActivity/updateStat/${id}`,
    data
  })
}
//分销推广-提现记录分页查询
export function withdrawalRecord(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/withdraw/page`,
    data
  })
}
//分销推广-提现审核状态变更
export function editWithdrawalRecord(data: object) {
  return request.post<BaseResponse>({
    url: `brokerage/withdraw/updateStatus`,
    data
  })
}
//分销推广-获取当前提现人的收款信息
export function paymentInformation(data: object) {
  return request.get<BaseResponse>({
    url: `brokerage/withdraw/getBank`,
    params: data
  })
}
//分销推广-手动打款后变更提现状态
export function editPaymentInfor(data: object) {
  return request.put<BaseResponse>({
    url: `brokerage/withdraw/put`,
    data
  })
}
//将本地素材上传至微信素材库
export function uploadMaterial(data: object) {
  return request.post<BaseResponse>({
    url: `wp/addMaterial`,
    data
  })
}
//根据微信素材 mediaId 获取文件url
export function getMaterial(data: object) {
  return request.post<BaseResponse>({
    url: `wp/getUrl`,
    data
  })
}

export function getCreatorPage(params: object) {
  return request.get<BaseResponse>({
    url: '/marketingVideo/getCreatorPage',
    params
  })
}

export function addCreator(data: object) {
  return request.post<BaseResponse>({
    url: '/marketingVideo/addCreator',
    data
  })
}

export function updateCreator(id: string, data: object) {
  return request.put<BaseResponse>({
    url: `/marketingVideo/updateCreator/${id}`,
    data
  })
}

export function delCreator(id: string) {
  return request.del<BaseResponse>({
    url: `/marketingVideo/delCreator/${id}`
  })
}

export function getVideoPage(params: object) {
  return request.get<BaseResponse>({
    url: '/marketingVideo/getVideoPage',
    params
  })
}

export function addVideo(data: object) {
  return request.post<BaseResponse>({
    url: '/marketingVideo/addVideo',
    data
  })
}

export function updateVideo(id: string, data: object) {
  return request.put<BaseResponse>({
    url: `/marketingVideo/updateVideo/${id}`,
    data
  })
}

export function updateVideoSortOrStat(id: string, data: object) {
  return request.put<BaseResponse>({
    url: `/marketingVideo/updateVideoSortOrStat/${id}`,
    data
  })
}

export function batchDelVideo(params: object) {
  return request.get<BaseResponse>({
    url: `/marketingVideo/batchDelVideo`,
    params
  })
}

export function getLiveRoomPage(data: object) {
  return request.post<BaseResponse>({
    url: '/liveStreaming/getLiveRoomPage',
    data
  })
}

export function getLiveRoomUrl(params: object) {
  return request.get<BaseResponse>({
    url: '/liveStreaming/getLiveRoomUrl',
    params
  })
}

export function addLiveRoom(data: object) {
  return request.post<BaseResponse>({
    url: '/liveStreaming/addLiveRoom',
    data
  })
}

export function putLiveRoom(data: object, id: string) {
  return request.put<BaseResponse>({
    url: `/liveStreaming/putLiveRoom/${id}`,
    data
  })
}

export function getCreatorOptions(params: object) {
  return request.get<BaseResponse>({
    url: '/marketingVideo/getCreatorOptions',
    params
  })
}

export function delLiveRoom(id: string) {
  return request.del<BaseResponse>({
    url: `/liveStreaming/delLiveRoom/${id}`
  })
}

export function changeLiveRoomStatus(id: string, data: object) {
  return request.put<BaseResponse>({
    url: `/liveStreaming/changeStatus/${id}`,
    data
  })
}

export function getDouyinLiveUrl(params: object) {
  return request.get<BaseResponse>({
    url: '/liveStreaming/getDouyinLiveUrl',
    params
  })
}